﻿<!DOCTYPE html>
<html lang="zh">

<head resource>
    <meta charset="utf-8">
    <include file="../inc/meta.inc" />
    <include file="inc/head.inc" />
    <title>试卷管理</title>
</head>

<body>
    <div id="vapp" v-cloak>
        <div class="toolsbar">
            <btngroup show="删除" ref='btngroup' @delete="deleteData" @calc="batchcalc" width="800" height="600"
                :selects='selects' idkey='Tr_ID' table="datatables" :modal="true"></btngroup>
            <query_panel :model="form" :loading="loading" @search="handleCurrentChange(1)">
                <el-form-item label="姓名">
                    <el-input v-model.trim="form.stname" style="width: 100px;" placeholder="学员姓名" clearable>
                    </el-input>
                </el-form-item>
                <el-form-item label="身份证">
                    <el-input v-model.trim="form.cardid" style="width: 150px;" placeholder="身份证" clearable>
                    </el-input>
                </el-form-item>
                <el-form-item label="">
                    <el-dropdown @command="dorphandle">
                        <span class="el-dropdown-link">
                            {{scorerange}}<i class="el-icon-arrow-down el-icon--right"></i>
                        </span>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item command="-1">
                                <el-tag type="info">全部</el-tag>
                            </el-dropdown-item>
                            <el-dropdown-item command="1">
                                <el-tag>优良({{Math.floor(testpaper.Tp_Total*0.8)}}分以上)</el-tag>
                            </el-dropdown-item>
                            <el-dropdown-item command="2">
                                <el-tag type="success">及格({{testpaper.Tp_PassScore}}分以上)</el-tag>
                            </el-dropdown-item>
                            <el-dropdown-item command="3">
                                <el-tag type="danger">不及格({{testpaper.Tp_PassScore}}分以下)</el-tag>
                            </el-dropdown-item>
                            <el-dropdown-item command="4">
                                <el-tag type="info">零分</el-tag>
                            </el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </el-form-item>

                <template v-slot:more>
                    <el-form-item label="分数">
                        <el-input v-model.number="form.score_min" style="width: 100px;" placeholder="低分" clearable>
                        </el-input>
                        -
                        <el-input v-model.number="form.score_max" style="width: 100px;" placeholder="高分" clearable>
                        </el-input>
                    </el-form-item>
                </template>
            </query_panel>
        </div>
        <!-- 数据列表-->
        <el-table ref="datatables" :data="datas" tooltip-effect="dark" style="width: 100%" stripe
            @selection-change="val=>selects=val" @row-dblclick="()=>{}" row-key="Tr_ID">
            <div slot="empty">
                <span v-if="!loading">未查询到数据</span>
            </div>
            <el-table-column type="selection" width="35" show-overflow-tooltip>
            </el-table-column>
            <el-table-column label="#" type="index" width="60" align="center">
                <template slot-scope="scope">
                    <span>{{(form.index - 1) * form.size + scope.$index + 1}}</span>
                </template>
            </el-table-column>

            <el-table-column label="学员">
                <template slot-scope="scope">
                    <icon :woman="scope.row.St_Sex=='2'" :man="scope.row.St_Sex!='2'"
                        v-html='showsearch(scope.row.Ac_Name,form.stname)' class="link large">
                    </icon>
                </template>
            </el-table-column>
            <el-table-column label="身份证">
                <template slot-scope="scope">
                    <span v-html='showsearch(scope.row.St_IDCardNumber,form.cardid)'></span>

                </template>
            </el-table-column>
            <el-table-column label="试卷" v-if="false">
                <template slot-scope="scope">
                    {{scope.row.Tp_Name}}
                </template>
            </el-table-column>
            <el-table-column label="交卷时间" width="150">
                <template slot-scope="scope">
                    {{scope.row.Tr_CrtTime|date('yyyy-M-d HH:mm:ss')}}
                </template>
            </el-table-column>
            <el-table-column label="成绩" align="center" width="100">
                <template slot-scope="scope">
                    <el-tooltip :content="scope.row.Tr_Score<testpaper.Tp_PassScore ? '不及格' : '点击查看成绩详情'"
                        placement="bottom" effect="light">
                        <span :class="{'red':scope.row.Tr_Score<testpaper.Tp_PassScore,'link':true}"
                            @click="viewresult(scope.row)">
                            <score :number="scope.row.Tr_Score"></score>
                        </span>
                    </el-tooltip>
                </template>
            </el-table-column>
            <el-table-column label="操作" show-overflow-tooltip width="100">
                <template slot-scope="scope">
                    <loading v-if="scope.row.loading"></loading>
                    <template v-else>
                        <el-popconfirm confirm-button-text='是的' cancel-button-text='不用' icon="el-icon-info"
                            icon-color="red" title="是否重新计算成绩？" @confirm="calcscore(scope.row)">
                            <el-link type="primary" plain icon="el-icon-finished" slot="reference">计算
                            </el-link>
                        </el-popconfirm>
                        <el-popconfirm confirm-button-text='是的' cancel-button-text='不用' icon="el-icon-info"
                            icon-color="red" title="确定删除吗？" @confirm="$refs.btngroup.delete(scope.row.Tr_ID)">
                            <el-link type="danger" plain icon="el-icon-delete" slot="reference">删除
                            </el-link>
                        </el-popconfirm>
                    </template>
                </template>
            </el-table-column>
        </el-table>


        <div id="pager-box">
            <el-pagination v-on:current-change="handleCurrentChange" :current-page="form.index" :page-sizes="[1]"
                :page-size="form.size" :pager-count="12" layout="total, prev, pager, next, jumper" :total="total">
            </el-pagination>
        </div>
    </div>
</body>

</html>